#pragma once
#include <vector>
#include "StandarPageWnd.h"
//#include "FrameWindowWnd.h"
//#include "ListInfo.h"
#include "..\StormWidgetUILibrary\ProgressBarUI.h"
#include "..\StormWidgetUILibrary\IList.h"
#include "..\StormWidgetUILibrary\PaintManagerUI.h"


class CControlUI;
class CListInfo;

class CListWindowWnd:public CStandarPageWnd, public IListCallbackUI,public IProgressBarCallbackUI
{
public:
	CListWindowWnd(HWND hWndParent);
	virtual ~CListWindowWnd(void);
public:
	LPCTSTR GetWindowClassName() const;
	LPCTSTR GetDialogResource() const;
	void Notify(TNotifyUI& msg);
	void OnPrepareAnimation();
	void OnExpandItem(CControlUI* pControl);
	// IListCallbackUI
	LPCTSTR GetItemText(CControlUI* pControl, int iIndex, int iSubItem);
	LPCTSTR GetImgItem(CControlUI* pList, int iItem);
	int CompareItem(CControlUI* pList, CControlUI* pItem1, CControlUI* pItem2);
	//void SetInfo(std::map<CStdString,CListInfo> info);
	void SetInfo(std::vector<CListInfo> info);
	void OnTaskStateChange(CStdString strTaskNo,CStdString strArgus);
	// IProgressBarUI
	int GetProgressPos();
	BOOL IsAllTaskDownloadFailed();
	//void SetCancelButtonDisabled();
	//void Invalidate();
private:
	void OnClickCancel();
	//void SetDownloadProgress(CStdString strState);
	//UINT GetDownloadProgress();
	//void SetDownloadProgress(CStdString strState);
	//UINT GetCompleteProgress();
	BOOL IsSetupComplete();
	void SetDownloadProgress(CStdString strName,CStdString strPercent);
	void SetCompleteProgress(CStdString strState);
private:
	HWND m_hWndParent;
	std::vector<CListInfo> m_ListInfo;
	CListUI* m_pList;
	CProgressBarUI* m_pProgressBar;
	CButtonUI* m_pCancel;
	CLabelPanelUI* m_ProgressText;
	CLabelPanelUI* m_ListNumberText;
	//UINT m_nDownloadComplete;
	UINT m_nDownloadSuccessed;
	UINT m_nDownloadFailed;
	bool m_bIsStart;

};

#define FOREACH_LISTINFO_BEGIN(szStr)				               \
	for(std::vector<CListInfo>::iterator it = m_ListInfo.begin();  \
	it!=m_ListInfo.end();++it)	                               \
{																	 \
	szStr = &(*it);								                   \

#define FOREACH_LISTINFO_END()									   \
}
